﻿<html>
	<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="Content-Language" content="zh-cn" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>mystr</title>
        {# CSS样式 #}
        <style type="text/css">
            #nav {
            height: 30px;
            width: 100%;
            }
            #nav ul {
            margin: 0 0 0 30px;
            line-height: 30px;
            white-space: nowrap;
            }
            li {
            list-style-type: none;
            display: inline;
            }
            #show_field a {
            text-decoration: none;
            color: #00008B;
            }
            #nav li a {
            text-decoration: none;
            padding: 0px 2px;
            background-color: #888888;
            color: #FFF;
            }
            #show_sort td a {
            font-size:18px;
            text-decoration: none;
            padding: 0px 2px;
            background-color: #686868;
            color: #FFF;
            }
            textarea{
                width: 280;
            }
        </style>
	</head>

    <body>
    {# 测试 #}
        {% ifnotequal testStr None %}
            <div id="testStr">
                {{ testStr }}
            </div>
        {% endifnotequal %}

        {# 当前分类和顶部导航 #}
        {% if navigationLinks %}
            <div id="nav">
                <ul>
                    {% ifnotequal currentSort None %}
                        <li>{{currentSort}}</li>
                    {% endifnotequal%}
                    {%for navigationLink in navigationLinks %}
                        <li><a href={{navigationLink.path}}>{{navigationLink.name}}</a></li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}

        {# 分类-显示 #}
        {% if sorts %}
            {% ifequal action 'show_sort' %}
                <div id="show_sort">
                    <table border="0">
                        {%for sort in sorts %}
                            {% if forloop.counter0|divisibleby:3 %}
                                <tr>
                            {% endif %}
                                <td><a href={{sort.path}}>{{sort.name}}</a></td>
                            {% if forloop.counter|divisibleby:3 %}
                                </tr>
                            {% endif %}
                        {% endfor %}
                    </table>
                </div>
            {% endifequal %}
        {% endif %}

        {# 分类-添加 #}
        {% ifequal action 'show_sort' %}
            <div id="add_sort">
                <form action={{actionPath}} method=post>
                <fieldset>
                    <legend>分类</legend>
                    <div><input type="text"  name="sort" maxlength="250"></div>
                    <div><input type="submit" value="添加分类"></div>
                </fieldset>
                </form>
            </div>
        {% endifequal %}

        {# 分类-修改 #}
        {% ifequal action 'update_sort' %}
            <div id="update_sort">
                <form action={{actionPath}} method=post>
                    <ul>
                        {%for sort in sorts%}
                            <li><input type="text" name="sort" value="{{sort.name}}"><br></li>
                        {% endfor %}
                        <div><input type="submit" value="修改分类"></div>
                    </ul>
                </form>
            </div>
        {% endifequal %}

        {# 字符串-显示 #}
        {% if fields %}
            {% ifequal action 'show_field' %}
                <div id="show_field">
                    {% for field in fields %}
                        <table border="1" cellpadding="0" cellspacing="0" bordercolor="#C0C0C0">
                        <tr>
                        {% ifequal field.type 'url' %}
                            <td>
                            {% ifnotequal field.name '' %}
                                <b>{{ field.name }}</b><br>
                            {% endifnotequal %}
                            {% ifnotequal field.remark None %}
                                {% ifnotequal field.name '' %}
                                    <a href={{ field.content }}>{{ field.remark }}</a><br>
                                {% else %}
                                    <a href={{ field.content }}><b>{{ field.remark }}</b></a><br>
                                {% endifnotequal %}
                            {% endifnotequal %}
                            <img src="http://g.etfv.co/{{ field.content }}" width="16" height="16" />{{ field.content|urlizetrunc:"40" }}
                            </td>
                        {% endifequal %}
                        {% ifequal field.type 'str' %}
                            <td>
                                {% ifnotequal field.name '' %}
                                    <b>{{ field.name }}</b><br>
                                {% endifnotequal %}
                                <textarea name="content" rows="{{ field.lineNum }}">{{ field.content }}</textarea>
                            </td>
                        {% endifequal %}
                        </tr>
                        </table><br>
                    {% endfor %}
                </div>
            {% endifequal %}
        {% endif %}

        {# 字符串-添加 #}
        {% ifequal action 'show_field' %}
            <div id="add_field">
                <form action={{actionPath}} method=post>
                <fieldset>
                    <legend>字符串</legend>
                    <label style="text-align:center">字符串名：</label><input type="text"  name="name" maxlength="250"><br>
                    <label style="text-align:center">字符串值：</label><textarea name="content"></textarea><br>
                    <input type="submit" value="添加字符串">
                </fieldset>
                </form>
            </div>
        {% endifequal %}

        {# 字符串-修改 #}
        {% ifequal action 'update_field' %}
            <div id="update_field">
                <form action={{actionPath}} method=post>
                    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#C0C0C0">
                    <tr>
                        <th>顶置</th>
                        <th>字符串名</th>
                        <th>字符串值</th>
                    </tr>
                        {% for field in fields %}
                            <tr>
                                <td><input type="radio" name="top" value = "{{ forloop.counter0 }}"></td>
                                <td><input type="text" name="name" maxlength="250" value={{field.name}}></td>
                                <td><textarea name="content">{{field.content}}</textarea></td>
                            </tr>
                        {% endfor %}
                    </table>
                    <input type="submit" value="修改字符串">
                </form>
            </div>
        {% endifequal %}

    {# 临时字符串 #}
    {% ifequal action 'show_sort' %}
        <div id="update_clipboard">
            <form action={{clipboardActionPath}} method=post>
            <fieldset>
                <legend>临时字符串</legend>
                {% ifnotequal clipboardField None %}
                    {% ifnotequal clipboardField.content '' %}
                        {% ifequal clipboardField.type 'url' %}
                            {% ifnotequal clipboardField.remark None %}
                                <a style="font-size:120%" href={{ clipboardField.content }}>{{ clipboardField.remark }}</a><br>
                            {% endifnotequal %}
                            <img src="http://g.etfv.co/{{ clipboardField.content }}" width="16" height="16" />{{ clipboardField.content|urlizetrunc:"40" }}<br>
                        {% endifequal %}
                        {% ifequal clipboardField.type 'str' %}
                            <textarea rows="{{ clipboardField.lineNum }}">{{ clipboardField.content }}</textarea><br>
                        {% endifequal %}
                    {% endifnotequal %}
                {% endifnotequal %}
                <textarea name="clipboardContent"></textarea><br>
                <div><input type="submit" value="修改临时字符串"></div>
            </fieldset>
            </form>
        </div>
    {% endifequal %}
	</body>
</html>